/**
 * @param {string[]} tokens
 * @return {number}
 */
 var evalRPN = function(tokens) {
    //边界
    let res = 0
    let map = new Map([
        ['+',(a,b)=>a*1 + b*1],
        ['-',(a,b)=>b - a],
        ['*',(a,b)=>a * b],
        ['/',(a,b)=>(b / a) | 0],
    ])
    let stack = []
    for(let i = 0;i<tokens.length;i++){
        if(map.has(tokens[i])){
            res= Math.floor(map.get(tokens[i])(stack.pop(),stack.pop()))
            stack.push(res)
        }
        else{
            stack.push(tokens[i])
        }      
    }
    return stack.pop()
};